#ifndef OPPONENT_H
#define OPPONENT_H

#include "..\models\md2model.h"
#include "..\player.h"

class Opponent
{
	protected:
		Opponent(MD2Model *opponentModel, MD2Model *weaponModel = NULL);
		MD2Model *opponentModel;
		MD2Model *weaponModel;

		char walkFrame[64];
		char runFrame[64];
		char stayFrame[64];
		char attackFrame[64];
		char hitFrame[64];
		char dieFrame[64];
		char currentFrame[64];

		double stayingAnimationSpeed;
		double walkingAnimationSpeed;
		double attackingAnimationSpeed;
		double bloodingAnimationSpeed;
		double dyingAnimationSpeed;

		double walkingSpeed;

		bool isStaying;
		bool isWalking;
		bool isAttacking;
		bool isBlooding;
		bool isDying;

		//defines whether the opponent moves or just stays in one place
		bool moves;
		
		//current positions of the player
		double posx;
		double posy;
		double posz;

		//extreme positions of the player
		double pos1x;
		double pos1y;
		double pos1z;

		double pos2x;
		double pos2y;
		double pos2z;

		//difference in extreme positions
		double deltaPosx;
		double deltaPosy;
		double deltaPosz;

		double speedx;
		double speedy;
		double speedz;

		short direction;

		int number;
		int life;

		void checkState(Player *player);

	public:
		~Opponent();
		void init();
		void virtual draw();
		//opponent was hit
		void hit(Player *player);
		void changePosition();
		void advanceAnimation(Player *player);
		void setAnimation(char* name, char *frameToReturn, bool returnToPreviousFrame);
		void setNumber(int value);
		int getNumber();
		void checkDistanceToPlayer(Vector playerPosition);
		void attack();
		void walk();
		void stay();
};

#endif //OPPONENT_H